package com.atguigu.spring6.iocxml.di;

public class Book {
    private String bname;
    private String author;

    private String others ;

    public Book() {
        System.out.println("无参构造方法执行了...");
    }

    public Book(String bname, String bauthor) {
        System.out.println("有参构造方法执行了...");
        this.bname = bname;
        this.author = bauthor;
    }

    public String getOthers() {
        return others;
    }

    public void setOthers(String others) {
        this.others = others;
    }

    //    生成set方法
    public void setBname(String bname) {
        this.bname = bname;
    }
    public void setAuthor(String author) {
        this.author = author;
    }

    public String getBname() {
        return bname;
    }
    public String getAuthor() {
        return author;
    }

    @Override
    public String toString() {
        return "Book{" +
                "bname='" + bname + '\'' +
                ", author='" + author + '\'' +
                ", others='" + others + '\'' +
                '}';
    }

    public static void main(String[] args) {
//        Book book = new Book();
//        book.setBname("Spring");
//        book.setAuthor("Rod Johnson");
//        System.out.println(book.getBname());
//        System.out.println(book.getAuthor());

//        通过构造方法注入
//        Book book1 = new Book("Spring","Rod Johnson");
    }
}
